// menu manage column
export function menuColumns() {
  const COLUMN_WIDTH = window.RPConfig.COLUMN_WIDTH
  return [
    {
      type: "selection",
      width: 80,
      align: "center"
    },
    {
      title: this.$t("module.menu.menuCode"),
      key: "menuCode",
      sortable: "custom",
      render: (h, params) => {
        return h(
          "div",
          {
            attrs: {
              class: "ivu-table-cell ivu-table-cell-ellipsis",
              title: params.row.menuCode
            }
          },
          params.row.menuCode
        );
      }
    },
    {
      title: this.$t("module.menu.menuName"),
      key: "menuName",
      sortable: "custom",
      render: (h, params) => {
        return h(
          "div",
          {
            attrs: {
              class: "ivu-table-cell ivu-table-cell-ellipsis",
              title: params.row.menuName
            }
          },
          params.row.menuName
        );
      }
    },
    {
      title: this.$t("module.menu.menuType"),
      key: "menuType",
      align: "center",
      minWidth: COLUMN_WIDTH.COLUMN_WIDTH_5_WORDS,
      maxWidth: COLUMN_WIDTH.COLUMN_WIDTH_5_WORDS + COLUMN_WIDTH.MAX_WIDTH_MORE,
      render: (h, params) => {
        return h(
          "div",
          {
            attrs: {
              class: "ivu-table-cell ivu-table-cell-ellipsis",
              title: this.menuTypeList[params.row.menuType]
            }
          },
          this.menuTypeList[params.row.menuType]
        );
      }
    },
    {
      title: this.$t("common.describe"), // 备注 改为 描述
      key: "remark",
      render: (h, params) => {
        return h(
          "div",
          {
            attrs: {
              class: "ivu-table-cell ivu-table-cell-ellipsis",
              title: params.row.remark
            }
          },
          params.row.remark
        );
      }
    },
    {
      title: this.$t("module.menu.effectBeginTime"), // 生效日期
      key: "effectBegin",
      minWidth: COLUMN_WIDTH.COLUMN_WIDTH_YYYYMMDD,
      maxWidth: COLUMN_WIDTH.COLUMN_WIDTH_YYYYMMDD + COLUMN_WIDTH.MAX_WIDTH_MORE,
      align: "center",
    },
    {
      title: this.$t("module.menu.effectEndTime"), // 失效日期
      key: "effectEnd",
      minWidth: COLUMN_WIDTH.COLUMN_WIDTH_YYYYMMDD,
      maxWidth: COLUMN_WIDTH.COLUMN_WIDTH_YYYYMMDD + COLUMN_WIDTH.MAX_WIDTH_MORE,
      align: "center",
    },
    {
      title: this.$t("common.status"),
      align: "center",
      minWidth: 80,
      maxWidth: 80 + COLUMN_WIDTH.MAX_WIDTH_MORE,
      key: "enabled",
      width: 120,
      render: (h, params) => {
        return h(
          "StatusButton",
          {
            // 修改StatusButton内容居中
            style: {
              "justify-content": "center"
            },
            props: {
              status: params.row.enabled == 1 ? "0" : "1"
            }
          },
          params.row.enabled ? this.$t("common.enable") : this.$t("common.disable")
        );
      }
    },
    {
      title: this.$t("common.operating"),
      align: "left",
      fixed: "right",
      width: 100,
      render: (h, params) => {
        return h("RowTools", {
          props: {
            data: this.getOperations(JSON.parse(JSON.stringify(params.row)))
          }
        });
      }
    }
  ];
}
